﻿using System.Data;
using NMock2;


namespace NMock3.Tests
{
	[NUnit.Framework.TestFixture]
	public class IMatchSyntaxTests
	{
		MockFactory _factory = new MockFactory();

		[NUnit.Framework.TearDown]
		public void TearDown()
		{
			_factory.VerifyAllExpectationsHaveBeenMet();
		}

		[NUnit.Framework.Test]
		public void OriginalGetPropertyTest()
		{
			Mock<ITester> mock = _factory.CreateMock<ITester>();

			DataSet ds = new DataSet("The Name");
			mock.Expects.One.SetProperty(m => m.Data).ToAnything();

			mock.Expects.One.GetProperty(m => m.Data).Will(Return.Value(ds));

			TestDriver driver = new TestDriver();
			driver.Test(mock.MockObject);


			NUnit.Framework.Assert.AreEqual("The Name", driver.Data.DataSetName);

		}

		[NUnit.Framework.Test]
		public void NewGetPropertyTest()
		{
			Mock<ITester> mock = _factory.CreateMock<ITester>();

			DataSet ds = new DataSet("The Name");

			mock.Expects.One.SetProperty(m => m.Data);
			mock.Expects.One.GetProperty(m => m.Data).WillReturn(ds);

			TestDriver driver = new TestDriver();
			driver.Test(mock.MockObject);


			NUnit.Framework.Assert.AreEqual("The Name", driver.Data.DataSetName);

			
		}

		[NUnit.Framework.Test]
		public void OriginalMethodWithTest()
		{
			
		}

		[NUnit.Framework.Test]
		public void NewMethodWithTest()
		{
			
		}


		public interface ITester
		{
			DataSet Data { get; set; }
			DataSet GetDate(int i);
		}

		private class TestDriver
		{
			public void Test(ITester tester)
			{
				tester.Data = new DataSet("test");

				Data = tester.Data;
			}

			public DataSet Data { get; private set; }
		}
	}
}
